#ifndef VRPOBJECTS_H
#define VRPOBJECTS_H

#include <boost/shared_ptr.hpp>
#include <QPointF>
#include <QPixmap>
#include <QPen>

#include "VRPRouteGraph.h"

class VRPDocument;

class Depo
{
protected:
    Depo(VRPRouteGraphTraits::Graph& graph, VRPRouteGraphTraits::Vertex vertex);
public:
    ~Depo();

    CirclePointPtr getCoordinate();

    friend class VRPDocument;

protected:
    VRPRouteGraphTraits::Graph& graph_;
    VRPRouteGraphTraits::Vertex vertex_;
};
typedef boost::shared_ptr<Depo> DepoPtr;


class Customer
{
public:
    Customer(VRPRouteGraphTraits::Graph& graph, VRPRouteGraphTraits::Vertex vertex);
    ~Customer();

    CirclePointPtr getCoordinate();
    QString getName();
    LineStringPtr getDepoRoute();
    int getDemand();
    bool getType();

    friend class VRPDocument;

private:
    VRPRouteGraphTraits::Graph& graph_;
    VRPRouteGraphTraits::Vertex vertex_;
};
typedef boost::shared_ptr<Customer> CustomerPtr;
Q_DECLARE_METATYPE(CustomerPtr)

class Vehicle
{
public:
    Vehicle(const QString &name, quint32 capacity = 10, quint32 cost = 1);
    ~Vehicle();

    void setCapacity(quint32 capacity);
    quint32 capacity();

    void setCost(quint32 cost);
    quint32 cost();

    void setName(const QString &name);
    QString name();

private:
    quint32 capacity_;
    quint32 cost_;
    QString name_;
};
typedef boost::shared_ptr<Vehicle> VehiclePtr;
Q_DECLARE_METATYPE(VehiclePtr)

struct CustomerInfo
{
    QString name;
    bool isBackhaul;
    quint32 demand;
    QPointF coordinate;

    QString toString()
    {
        QString str = " Customer:{Name = " + name + ", ";
        str += "Coordinate = (" + QString::number(coordinate.x()) + "," + QString::number(coordinate.y()) + "), ";
        str += "IsBackhaul = " + QString::number(isBackhaul) + ", Demand = " + QString::number(demand) + "}";
        return str;
    }
};

struct RouteType
{
    RouteType(){}
    RouteType(LineStringPtr ls, std::size_t w)
        :lineString(ls), weight(w)
    {
    }

    LineStringPtr lineString;
    std::size_t weight;
};

class VRPPixmapsFactory
{
protected:
    VRPPixmapsFactory();

    static VRPPixmapsFactory* inst_;
    QPixmap* depoPixmap_;
    QPixmap* customerPixmap_;

    QPen* routePen_;

public:
    ~VRPPixmapsFactory();
    static VRPPixmapsFactory* instance();
    QPixmap* createdDepoPixmap();
    QPixmap* createCustomerPixmap();
    QPen* routePen();
};

#endif // VRPOBJECTS_H
